<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>删除节点</title>
    <script>
        function f1(){
            let u1 = document.getElementById("u1");
            let i3 = document.getElementById("i3");
            // 删除u1节点中的指定子节点i3
            u1.removeChild(i3);
        }
        function f2(){
            let u1 = document.getElementById("u1");
            // 删除节点u1
            u1.remove();
        }
    </script>
</head>
<body>
<button onclick="f1()">删除指定子节点</button><br>
<button onclick="f2()">删除整个节点</button><br>
<ul id="u1">
    <li>item1</li>
    <li>item2</li>
    <li id="i3">item3</li>
    <li>item4</li>
    <li>item5</li>
</ul>
</body>
</html>